package com.tdkj.action.backstage.shop;

import java.math.BigDecimal;
import java.util.List;

import javax.annotation.Resource;

import com.tdkj.action.BaseAction;
import com.tdkj.model.shop.BeanGoodShowcaseCustom;
import com.tdkj.model.shop.BeanGoodShowcaseDefault;
import com.tdkj.service.shop.IBeanGoodShowcaseCustomService;
import com.tdkj.service.shop.IBeanGoodShowcaseDefaultService;


public class GoodShowcaseCustomAction extends BaseAction {
    
	private IBeanGoodShowcaseCustomService goodShowcaseCustomService;
	
	private IBeanGoodShowcaseDefaultService goodShowcaseDefaultService;
	
	
	private Long id;
	private Integer quantity;
	private BigDecimal price;
	private String unit;
	
	private BeanGoodShowcaseDefault goodShowcaseDefault ;
	
	private BeanGoodShowcaseCustom goodShowcaseCustom ;
	
	private List<BeanGoodShowcaseCustom> goodShowcaseCustoms ;
	
	public String add() {
		goodShowcaseCustomService.add(quantity, unit, price);
		return execute();
	}
	
	public String edit() {
		goodShowcaseCustom = goodShowcaseCustomService.findById(id, BeanGoodShowcaseCustom.class);
		return "edit";
	}
	
	public String update() {
		goodShowcaseCustomService.update(id, quantity, unit, price);
		return edit();
	}

	public String del() {
		goodShowcaseCustomService.delete(id, BeanGoodShowcaseCustom.class);
		return execute();
	}
	
	public String execute() {
		goodShowcaseDefault = goodShowcaseDefaultService.getGoodShowcaseDefault();
		goodShowcaseCustoms = goodShowcaseCustomService.findAll(BeanGoodShowcaseCustom.class);
		return "success";
	}

	/**
	 * @return the id
	 */
	public Long getId() {
		return id;
	}

	/**
	 * @param id the id to set
	 */
	public void setId(Long id) {
		this.id = id;
	}

	/**
	 * @return the quantity
	 */
	public Integer getQuantity() {
		return quantity;
	}

	/**
	 * @param quantity the quantity to set
	 */
	public void setQuantity(Integer quantity) {
		this.quantity = quantity;
	}

	/**
	 * @return the price
	 */
	public BigDecimal getPrice() {
		return price;
	}

	/**
	 * @param price the price to set
	 */
	public void setPrice(BigDecimal price) {
		this.price = price;
	}

	/**
	 * @return the unit
	 */
	public String getUnit() {
		return unit;
	}

	/**
	 * @param unit the unit to set
	 */
	public void setUnit(String unit) {
		this.unit = unit;
	}

	/**
	 * @return the goodShowcaseDefault
	 */
	public BeanGoodShowcaseDefault getGoodShowcaseDefault() {
		return goodShowcaseDefault;
	}

	/**
	 * @param goodShowcaseDefault the goodShowcaseDefault to set
	 */
	public void setGoodShowcaseDefault(BeanGoodShowcaseDefault goodShowcaseDefault) {
		this.goodShowcaseDefault = goodShowcaseDefault;
	}

	/**
	 * @return the goodShowcaseCustom
	 */
	public BeanGoodShowcaseCustom getGoodShowcaseCustom() {
		return goodShowcaseCustom;
	}

	/**
	 * @param goodShowcaseCustom the goodShowcaseCustom to set
	 */
	public void setGoodShowcaseCustom(BeanGoodShowcaseCustom goodShowcaseCustom) {
		this.goodShowcaseCustom = goodShowcaseCustom;
	}

	/**
	 * @return the goodShowcaseCustoms
	 */
	public List<BeanGoodShowcaseCustom> getGoodShowcaseCustoms() {
		return goodShowcaseCustoms;
	}

	/**
	 * @param goodShowcaseCustoms the goodShowcaseCustoms to set
	 */
	public void setGoodShowcaseCustoms(
			List<BeanGoodShowcaseCustom> goodShowcaseCustoms) {
		this.goodShowcaseCustoms = goodShowcaseCustoms;
	}

	/**
	 * @param goodShowcaseCustomService the goodShowcaseCustomService to set
	 */
	@Resource
	public void setGoodShowcaseCustomService(
			IBeanGoodShowcaseCustomService goodShowcaseCustomService) {
		this.goodShowcaseCustomService = goodShowcaseCustomService;
	}

	/**
	 * @param goodShowcaseDefaultService the goodShowcaseDefaultService to set
	 */
	@Resource
	public void setGoodShowcaseDefaultService(
			IBeanGoodShowcaseDefaultService goodShowcaseDefaultService) {
		this.goodShowcaseDefaultService = goodShowcaseDefaultService;
	}
	
}
